package br.com.news.database.services;

import javax.inject.Inject;
import javax.inject.Named;

import br.com.news.database.daos.interfaces.IFonteDao;
import br.com.news.database.entities.FonteEntity;
import br.com.news.database.utils.GenericService;
import br.com.news.database.utils.interfaces.IGenericDao;
import br.com.news.utils.database.beans.FonteBean;
import br.com.news.utils.database.interfaces.IFonteServiceDb;

@Named
public class FonteServiceDb extends GenericService<FonteBean, FonteEntity, Long> implements IFonteServiceDb{

	@Inject
	private IFonteDao fonteDao;

	@Override
	protected IGenericDao<FonteEntity, Long> getConcreteDao() {
		return this.fonteDao;
	}

	@Override
	public FonteBean buscaPorNome(String descricao) {
		FonteEntity fonteEntity = fonteDao.buscaPorNome(descricao);
		if (fonteEntity != null) {
			return parserEntity(fonteEntity);
		}
		return null;
	}

}
